/*
 * Copyright © 2021-now 尛飛俠（Denvie） All rights reserved.
 */

package cn.denvie.springboot.dds.service.impl;

import cn.denvie.springboot.dds.entity.User;
import cn.denvie.springboot.dds.mapper.UserMapper;
import cn.denvie.springboot.dds.service.UserService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户服务实现类。
 *
 * @author Denvie
 * @date 2022/3/28
 * @since 1.0.0
 */
@Service("userServiceImpl")
@ConditionalOnProperty(name = "spring.profiles.active", havingValue = "dynamic-datasource")
@DS("ds1")
public class DynamicDataSourceUserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Override
    public List<User> query1() {
        return UserService.super.query1();
    }

    @DS("ds2")
    @Override
    public List<User> query2() {
        return UserService.super.query2();
    }
}
